<!DOCTYPE html>
<html lang="en">
<head>
  <title>Position click test</title>
  <meta charset="UTF-8">
  <style type="text/css">
    body {
      margin: 0;
    }

    #page {
      position: absolute;
      text-align: center;
      line-height: 100%;
      left: 200px;
      top: 100px;
      bottom: 0;
      width: 800px;
      height: 600px;
      margin: 0;
      padding: 0;
      background-color: lightgrey;
      border: 1px dotted grey;
      vertical-align: middle;
    }

    #coords {
      position: absolute;
      margin: 0;
      padding: 10px;
      border: 1px dotted black;
      background-color: aqua;
    }

  </style>
  <script type="text/javascript">
    function clickRel(event) {
      var coords = document.getElementById("coords");
      coords.innerText = '(' + event.offsetX + ', ' + event.offsetY + ')';
      coords.style.left = event.offsetX + 'px';
      coords.style.top = event.offsetY + 'px';
      return false;
    }
  </script>
</head>
<body>
  <div id="page">THIS IS A TEST</div>
  <span id="coords">(0, 0)</span>
  <script type="text/javascript">
    document.getElementById('page').addEventListener('click', clickRel);
  </script>
</body>
</html>
